package com.travel.controller;

import com.qianfeng.util.ResultMsg;
import com.travel.service.CartService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Date;

@RestController
@RequestMapping("/cart")
public class FontCartController {
    @Autowired
    CartService cartService;
    /**
     * 查询所有汽车班次
     * */
    @GetMapping("/findAllCart")
    public ResultMsg findAllCart(@RequestParam(required = false,defaultValue = "1") int current, @RequestParam(required = false,defaultValue = "5") int size){
        return cartService.findAllCart(current,size);
    }
    /**
     * 通过id查询单个汽车班次
     * */
    @GetMapping("/getCartById")
    public ResultMsg getCartById(int carId){
        return cartService.getCartById(carId);
    }
    /**
     * 通过起始站，终点站查询符合条件的汽车班次
     * */
    @GetMapping("/getCartByName")
    public ResultMsg getCartByName(String carSname,String carEname){
        return cartService.getCartByName(carSname,carEname);
    }
    /**
     * 通过日期查询汽车班次
     * */
    /*@GetMapping("/getCartByDate")
    public ResultMsg getCartByDate(Date carStime){
        return cartService.getCartByDate(carStime);
    }*/
    /*@GetMapping("/getAllCart")
    public ResultMsg getAllCart(){
        return cartService.getAllCart();
    }*/

}
